﻿using System;
using System.Threading.Tasks;

namespace CsharpTool.SignalRServer
{
    ///// <summary>
    ///// 消息发送
    ///// </summary>
    //public interface IMessageSend<in TSendData> : IDisposable
    //{
    //    /// <summary>
    //    /// 发送消息给指定客户端
    //    /// </summary>
    //    /// <param name="connectionId">连接ID</param>
    //    /// <param name="msg">消息</param>
    //    Task SendMsgAsync(string connectionId, TSendData msg);

    //    /// <summary>
    //    /// 发送消息给多个客户端
    //    /// </summary>
    //    /// <param name="connectionIds">连接ID</param>
    //    /// <param name="msg">消息</param>
    //    Task SendMsgAsync(TSendData msg, params string[] connectionIds);

    //    /// <summary>
    //    /// 发送消息给所有客户端
    //    /// </summary>
    //    Task SendMsgAllAsync(TSendData msg);
    //}

    /// <summary>
    /// 消息发送
    /// </summary>
    public interface IMessageSend : IDisposable
    {
        /// <summary>
        /// 发送消息给指定客户端
        /// </summary>
        /// <param name="connectionId">连接ID</param>
        /// <param name="msg">消息</param>
        Task SendMsgAsync<TSendData>(string connectionId, TSendData msg);

        /// <summary>
        /// 发送消息给多个客户端
        /// </summary>
        /// <param name="connectionIds">连接ID</param>
        /// <param name="msg">消息</param>
        Task SendMsgAsync<TSendData>(TSendData msg, params string[] connectionIds);

        /// <summary>
        /// 发送消息给所有客户端
        /// </summary>
        Task SendMsgAllAsync<TSendData>(TSendData msg);
    }
}
